package knu;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Ray on 2014-12-09.
 */
@WebServlet(name = "Submit_Servlet")
public class Submit_Servlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        String ans=request.getParameter("answer");
        int ansint=Integer.parseInt(ans);
        response.getWriter().printf("제출한 답은 %d 번이며 결과는 %s",ansint,ansint==3?"정답":"오답");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().printf("잘못된 접근입니다");

    }
}
